package com.jhsw.roadsun.module.business.controller.admin.expressage.vo;

import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.jhsw.roadsun.framework.excel.core.annotations.DictFormat;
import com.jhsw.roadsun.framework.excel.core.convert.DictConvert;
import com.jhsw.roadsun.module.business.enums.DictTypeConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

import static com.jhsw.roadsun.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 寄件信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ExpressageRespVO {

    @Schema(description = "寄件ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9001")
    @ExcelIgnore
    private Long id;

    @Schema(description = "运单号", example = "2")
    @ExcelProperty("运单号")
    private String orderNo;

    @Schema(description = "下单时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("下单时间")
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime createTime;

    @Schema(description = "快递状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty(value = "快递状态", converter = DictConvert.class)
    @DictFormat(DictTypeConstants.BUSINESS_EXPRESSAGE_AUDIT_STATUS)
    private Integer auditStatus;

    @Schema(description = "操作时间")
    @ExcelProperty("操作时间")
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime auditDatetime;

    @Schema(description = "下单人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3522")
    @ExcelProperty("下单人ID")
    private Long userId;

    @Schema(description = "用户昵称", example = "2")
    @ExcelProperty("昵称")
    private String nickname;

    @Schema(description = "用户手机号", example = "2")
    @ExcelProperty("手机号")
    private String mobile;

    @Schema(description = "收件国家", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("收件国家")
    private String country;

    @Schema(description = "运输方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty("运输方式")
    private String shippingType;

    @Schema(description = "是否报关（0否 1是）")
    @ExcelProperty(value = "是否报关", converter = DictConvert.class)
    @DictFormat(DictTypeConstants.BUSINESS_EXPRESSAGE_CUSTOMS_FILING)
    private Integer customsFiling;

    @ExcelProperty("寄件人姓名")
    private String sendName;

    @ExcelProperty("寄件人手机号")
    private String sendMobile;

    @ExcelProperty("寄件人详细地址")
    private String sendAddress;

    @Schema(description = "寄件方公司抬头", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("寄件方公司抬头")
    private String sendCompany;

    @ExcelProperty("寄件人所属部门")
    private String sendDept;

    @ExcelProperty("收件人姓名")
    private String recipientsName;

    @ExcelProperty("收件人手机号")
    private String recipientsMobile;

    @ExcelProperty("收件人详细地址")
    private String recipientsAddress;

    @Schema(description = "收件方公司抬头", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("收件方公司抬头")
    private String recipientsCompany;

    @ExcelProperty("收件人所属部门")
    private String recipientsDept;

    @Schema(description = "结款方式（0寄付 1到付 2第三方结款）（字典：business_expressage_pay_method）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty(value = "结款方式", converter = DictConvert.class)
    @DictFormat(DictTypeConstants.BUSINESS_EXPRESSAGE_PAY_METHOD)
    private Integer payMethod;

    @Schema(description = "客户账号", example = "6085")
    @ExcelProperty("客户账号")
    private String customerAccount;

    @Schema(description = "快递单号")
    @ExcelProperty("快递单号")
    private String expressageOrder;

    @ExcelProperty("发票号")
    private String invoiceNum;
}
